fix: debounce tunnel tile updates to prevent notification flicker#1195
Closed
naonak wants to merge 1 commit into
Closed
fix: debounce tunnel tile updates to prevent notification flicker#1195naonak wants to merge 1 commit into
naonak wants to merge 1 commit into
Conversation
TunnelServiceHandler was calling updateTunnelTile() on every activeTunnels emission, including high-frequency stats updates (every ~1 second). This caused Android to continuously redraw the foreground service notification, producing visible flicker in the notification shade. Fix: map activeTunnels to status-only before collecting, then distinctUntilChanged() to skip emissions where nothing meaningful changed. updateTunnelTile() now only fires on actual tunnel state transitions (added, removed, status change), not on stats or ping updates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
need more testing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TunnelServiceHandlercallsupdateTunnelTile()on everyactiveTunnelsemission. Because stats are polled every ~1 second, this causes Android to continuously redraw the foreground service notification, producing visible flicker in the notification shade even when no meaningful state has changed.Fix
Map
activeTunnelsto status-only before collecting, thendistinctUntilChanged()to suppress emissions where nothing changed.updateTunnelTile()now only fires on actual tunnel state transitions (tunnel added/removed, status change) — not on stats or ping updates.activeTunnels .map { tunnels -> tunnels.mapValues { it.value.status } } .distinctUntilChanged() .collect { ... }Impact
🤖 Generated with Claude Code